/*
 * UnaryNegOperatorAst.cpp
 *
 *  CreNegd on: 1 Nov 2010
 *      Author: ph1109
 */

#include <MAlice/Ast/UnaryNegOperatorAst.h>

namespace MAlice
{

UnaryNegOperatorAst::UnaryNegOperatorAst(ExpressionAst* lhs) :
	UnaryOperatorAst("-", lhs)
{
}

UnaryNegOperatorAst::~UnaryNegOperatorAst()
{

}

llvm::Value* UnaryNegOperatorAst::generate()
{
	Value* LHS = getLHS()->generate();
	Builder* builder = MAlice::Codegen::get()->getBuilder();
	return builder->CreateNeg(LHS, getName(LHS));
}

}
